import SessionItem from './SessionItem'
import { chatsAtom } from '@/atoms'
import { useAtomValue } from 'jotai'
import { List } from '@mui/material'

export default function SessionList() {
  const chats = useAtomValue(chatsAtom)
  const chatsList = [...chats].reverse()

  // 在这里做默认值
  return (
    <List>
      {chatsList.map(session => (
        <SessionItem
          key={session.id}
          session={session}
        />
      ))}
    </List>
  )
}
